package com.shanhy.example.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.jedis.RedisClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.shanhy.example.service.TestService;

/**
 * 测试Controller
 * 
 * @author 单红宇(365384722)
 * @myblog http://blog.csdn.net/catoop/
 * @create 2017年4月9日
 */
@RestController
@RequestMapping("/test")
public class TestController {

	private static final Logger LOG = LoggerFactory.getLogger(TestController.class);
	
	@Autowired
	private RedisClient redisClient;
	
	@Autowired
	private TestService testService;
	
	@GetMapping("/redisCache")
	public String redisCache() {
		redisClient.set("shanhy", "hello,shanhy", 100);
		LOG.info("getRedisValue = {}", redisClient.get("shanhy"));
		testService.testCache2("aaa", "bbb");
		return testService.testCache();
	}
}
